import Http from "../utils/Http";
import constant from "../config/constant";

export default class OrderModel extends Http {

  getProduct(data) {
    return this.request({
      url: '/h5/order/query-product',
      data
    })
  }

  getAccount(data) {
    return this.request({
      url: '/h5/order/query-account',
      data
    })
  }

  getAddress(data) {
    return this.request({
      url: '/h5/order/query-address',
      data
    })
  }

  isRemoteCity(data) {
    return this.request({
      url: '/h5/order/is-remote-city',
      data
    })
  }

  checkReferrer(data) {
    return this.request({
      url: '/h5/order/check-referrer',
      data
    })
  }

  checkGroup(data) {
    return this.request({
      url: '/h5/order/check-group',
      data
    })
  }

  checkSecondKill(data) {
    return this.request({
      url: '/h5/order/check-second-kill',
      data
    })
  }

  saveParams(params) {
    wx.setStorageSync(constant.orderParamKey, params)
  }

  getParams() {
    return wx.getStorageSync(constant.orderParamKey)
  }

  // go
  createOrder(data) {
    return this.request({
      url: '/h5/order/create-order',
      data
    })
  }

  // order list
  orderList(data) {
    return this.request({
      url: '/h5/my/order/list',
      data
    })
  }

  orderDelete(data) {
    return this.request({
      url: '/h5/my/order/delete',
      data
    })
  }

  orderResetPay(data) {
    return this.request({
      url: '/h5/my/order/reset-pay',
      data
    })
  }

  orderConfirmReceived(data) {
    return this.request({
      url: '/h5/my/order/confirm-received',
      data
    })
  }

  orderFinish(data) {
    return this.request({
      url: '/h5/my/order/finish',
      data
    })
  }

  getQrcode(data) {
    return this.request({
      url: '/h5/my/order/get-qrcode',
      data
    })
  }

  scanQrcode(data) {
    return this.request({
      url: '/h5/my/order/scan-qrcode',
      data
    })
  }

  // 查看物流
  viewExpress(data) {
    return this.request({
      url: '/h5/my/order/express',
      data
    })
  }

}
